import { useLocalStore } from 'mobx-react-lite';
import { Choerodon } from '@choerodon/boot';
import { organizationsApi } from '@choerodon/master';

export default function useStore() {
  return useLocalStore(() => ({
    dingdingDisable: true,

    get getDingdingDisable() {
      return this.dingdingDisable;
    },

    setDingdingDisable(data) {
      this.dingdingDisable = data;
    },
    async loadDingdingDisable() {
      try {
        const res = await organizationsApi.getDingdingDisable();
        this.setDingdingDisable(res);
      } catch (e) {
        Choerodon.handleResponseError(e);
      }
    },
  }));
}
